<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>APP版本列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<style>
.table tbody th{
	text-align:left;
}
.table tbody td{
	text-align:left;
}
</style>
<script>
$(function(){
	$("#show_rule_box").click(function(){
		var __this =$(this);
		__this.after("<input type='text' style='width:200px;' name='update_rule_in'><span style='color:red'>(格式例如：nowVersion<2.0)</span>");
		$("#hide_rule_select").remove();
		__this.attr('disabled','disabled');
	});
});

</script>
</head>
<body>
<div class="container">
	<{if $smarty.get.act=='add' or $smarty.get.act=='edit'}>
		<div class="flow">
	        <div class="itemtitle">
	            <h3><{if $smarty.get.act=='add'}>添加<{else}>编辑<{/if}></h3>
	            <ul>
                    <li><a href="?m=global&s=app_version.php"><span>版本列表</span></a></li>
                </ul>
	        </div>
	    </div>
	    <div class="h35"></div>
	    
	    <form action="" method="post">
	    	<input type="hidden" name="act" value="save">
	    	<{if $smarty.get.act=='edit'}>
	    		<input type="hidden" name="editid" value="<{$smarty.get.id}>">
	    	<{/if}>
			<table width="100%" border="0" cellspacing="1" cellpadding="0">
				<tr>
			      <td width="30" height="50">版本编号:</td>
			      <td width="310" ><input class="text" type="text" name="version" value="<{$de.version_info.version}>"></td>
			    </tr>
			    <tr>
			      <td width="30" height="50">系统类型:</td>
			      <td width="310" >
			      	<select name="client_system">
			      		<option value="1" <{if $de.version_info.client_system=='1'}> selected <{/if}>>IOS</option>
			      		<option value="2" <{if $de.version_info.client_system=='2'}> selected <{/if}>>Android</option>
			      	</select>
			      </td>
			    </tr>
			    <tr>
			      <td width="30" height="50">下载地址:</td>
			      <td width="510" ><input style="width:506px;" class="text" type="text" name="download_url" value="<{$de.version_info.download_url}>"></td>
			    </tr>
			    <tr>
			      <td width="40" height="100">强制更新条件:</td>
			      <td width="500" >
			      		<div id="hide_rule_select" style="display:inline-block;">
				      		版本低于<select name="update_rule_se">
				      			<option value="">--请选择--</option>
				      			<{foreach item=version from=$de.versions}>
				      				<option value="<{$version.version}>"><{$version.version}></option>
				      			<{/foreach}>
				      		</select>
			      		</div>
			      		<input type="button" id="show_rule_box" value="高级" />
			      </td>
			    </tr>
			    <tr>
			      <td width="30" height="100">版本描述:</td>
			      <td width="500" ><textarea name="description" style="width:500px;height:100px;"><{$de.version_info.description}></textarea></td>
			    </tr>
			    <tr>
			      <td width="30" height="50"></td>
			      <td width="310" ><input class="btn" type="submit" name="submit" value="提交"></td>
			    </tr>
		  	</table>
  		</form>
	<{else}>
	    <div class="flow">
	        <div class="itemtitle">
	            <h3>版本列表</h3>
	            <ul>
                    <li><a href="?m=global&s=app_version.php&act=add"><span>添加</span></a></li>
                </ul>
	        </div>
	    </div>
	    
	    <div class="h35"></div>
	    
	    <form action="" method="get">
	    <input type="hidden" name="m" value="global">
	    <input type="hidden" name="s" value="app_version.php">
	    <table class="select_table">
	        <tbody>
	            <tr>
					<td width="60">系统类型:</td>
	                <td width="30">
	                	<select name="client_system">
	                		<option value="">全部</option>
                			<option value="1" <{if $smarty.get.client_system=='1'}> selected <{/if}> >IOS</option>
                			<option value="2" <{if $smarty.get.client_system=='2'}> selected <{/if}> >Android</option>
	                	</select>
	                </td>
	                <input type="hidden" id="order" name="" value="" />
	                <td><input id="search" type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
	            </tr>
	            
	        </tbody>
	    </table>
	    </form>
	
		<form action="" name="snsform" method="get">
		<input type="hidden" name="m" value="global">
	    <input type="hidden" name="s" value="app_version.php">
	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="50">ID</th>
	                <th width="100">版本号</th>
	                <th width="100">系统类型</th>
	                <th width="80">下载地址</th>
	                <th width="100">版本描述</th>
	                <th width="50">强制更新条件</th>
	                <th width="50"><a href="javascript:doorder('ctimeorder','<{if $smarty.get.ctimeorder==desc}>asc<{else}>desc<{/if}>');">发布时间</a></th>
	                <th width="100">操作</th>
	            </tr>
	            <{foreach item=list from=$de.list}>
	            <tr>
	                <td><{$list.id}></td>
	                <td><{$list.version}></td>
	                <td><{if $list.client_system=='1'}>IOS<{else if $list.client_system=='2'}>Android<{/if}></td>
	                <td style="word-break: break-all;"><{$list.download_url}></td>
	                <td title="<{$list.description}>" style="display:block;width:150px;height:30px;line-height:19px;overflow:hidden;" alt="<$list.description>"><{$list.description}></td>
	                <td><{$list.must_updated_rule}></td>
	                <td><{$list.create_time}></td>
	                <td>
                		<a href="?m=global&s=app_version.php&act=edit&id=<{$list.id}>"><input type="button" value="编辑" /></a><br /><br />
	                </td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99">
	                	<div class="page"><{$de.page}><{if $countpro}></div>共有<{$countpro}>条记录<{/if}>
	                </td>
	            </tr>
	        </tfoot>
	    </table>
	    </form>
    <{/if}>
</div>
</body>
<script>
//排序
function doorder(key,value){
	var order = $('#order');
	order.attr('name',key);
	order.attr('value',value);
	
	$('#search').trigger('click');
}
</script>
</html>